import os
import json
from idlelib.iomenu import encoding

# 文件路径配置
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# url配置
URL = "http://kapi.ksit.kaikela.cn/api.do"
URL_xhx_login = "http://xhx.xsit.kaikela.cn/passport/gettoken"
URL_GO = "http://xhx.xsit.kaikela.cn/goproxy"

# 链接数据库：estudy_db; kaikela_mem; kaikela_support; bigdata; estudy_cpcore; estudy_recruit; estudy_class; wechat;
SQL_data = ["10.0.0.233",3502,"xhx_user","A654321","bigdata"]



# 读取 config 文件内容
def load_config():
    with open(os.path.join(BASE_DIR+"/data/", 'config.json'), 'r', encoding='utf-8') as f:
        return json.load(f)

# # 写入 config 文件内容
# def save_config(config_data):
#     with open(os.path.join(BASE_DIR+"/data/", 'config.json'), 'w', encoding='utf-8') as f:
#         json.dump(config_data, f, indent=4)

TOKEN_RESULT = [
    {"token":"nbl5Ynt6li9kg64d2nqpo0N2uocnFLv4fmCFZbELf8iBE0I2EsP1QJ9ieEfd-002",
     "xhx_token":{"xhxtoken":"m0005267_7ae0629eb82d35be3862638a6f038c4b30"}}
]



# 打印请求信息
def prints(response):
    print(f"Request URL: {response.request.url}")
    print(f"Request status: {response.status_code}")
    print(f"Request Headers: {response.request.headers}")
    print(f"Request Body: {response.request.body}")

# .body.decode('utf-8')

if __name__ == "__main__":
    print(BASE_DIR)